<template>
  <drawer-edit-layout ref="layout" :title="params.title" :show="params.show" :disable="params.disable" :loading="page.process.form" @invoke="invoke">
    <el-form v-if="!page.process.form" ref="form" :model="form" size="default" label-width="90px">
      <el-form-item v-if="form.id==null" label="供应商" prop="supplierId" :rules="page.rules.def">
        <form-remote-select
          v-model="form.supplierId"
          :url="service.conf.api.get('wms').url+'/api/sup/supplier-info/map/0'"
        />
      </el-form-item>
      <el-form-item v-if="form.supplierName" label="供应商">
        <label>{{ form.supplierName }}</label>
      </el-form-item>
      <el-form-item label="收款方式" prop="bankName" :rules="page.rules.def">
        <el-select v-model="form.bankName" size="small" placeholder="请选择">
          <el-option
            v-for="item in constants.banks"
            :key="item"
            :label="item"
            :value="item"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="开户行" prop="openingBank">
        <el-input v-model="form.openingBank" class="col" placeholder="请输入开户行" />
      </el-form-item>
      <el-form-item label="收款人" prop="accountName" :rules="page.rules.zh">
        <el-input v-model="form.accountName" class="col" placeholder="请输入收款人" />
      </el-form-item>
      <el-form-item label="账号/卡号" prop="cardNumber" :rules="page.rules.def">
        <el-input v-model="form.cardNumber" class="col" placeholder="请输入账号/卡号" />
      </el-form-item>
      <el-form-item label="备注" prop="remark">
        <el-input v-model="form.remark" class="col-6" type="textarea" :rows="2" placeholder="请输入备注" />
      </el-form-item>
    </el-form>
  </drawer-edit-layout>
</template>
<script>
import adminSupport from 'lola-admin-support-el'

export default {
  name: 'BankManageEdit',
  mixins: [adminSupport.mixins.drawerEdit],
  props: {
  },
  data() {
    return {
      name: 'BankManage',
      form: {},
      params: {
        id: 0,
        title: '',
        show: false,
        disable: false
      }
    }
  },
  watch: {
    'params.id': function(n, o) {
      // this.loadData()
    }
  },
  created() {
    // this.init()// 初始化
  },
  methods: {
    init(params) {
      this.params = params
      this.loadData()
    },
    appendForm() {
      if (this.form.parent == null) {
        this.form.parent = { id: null, name: null }
      }
      let powerIds = []
      if (!String.isNullOrEmpty(this.form.powerIds)) {
        powerIds = this.form.powerIds.split(',')
      }
      this.form.powerIds = powerIds
    }, buildForm() {
      this.form.powerIds = this.form.powerIds.join(',')
      return true
    }
  }
}
</script>
